#include <iostream>

using namespace std;

class a
{
public:
    int x;

public:
    void setX(int x)
    {
        this->x = x;
        printAddress();
    }
    void printAddress()
    {
        cout << this << endl; // 哪个变量调用printAddress这个函数，this就是谁的地址
    }
};

int main()
{
    a a1;
    a a2;
    a1.setX(100);
    a1.printAddress(); // 打印a1的地址
    a2.printAddress(); // 打印a2的地址
    cout << a1.x<< endl;
    return 0;
}
